<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head-fragment(title,path)">
    <meta charset="UTF-8">
    <title>瞬联商城 newbee-mall</title>
    <link rel="stylesheet" th:href="@{/mall/css/swiper-bundle.min.css}">
    <link rel="stylesheet" th:href="@{/mall/css/iconfont.css}">
    <link rel="stylesheet" th:href="@{/mall/css/common.css}">
    <link rel="stylesheet" th:href="@{/mall/styles/header.css}">
    <link rel="stylesheet" th:href="@{'/mall/styles/'+${path}+'.css'}">
    <link rel="stylesheet" th:href="@{/admin/plugins/sweetalert2/sweetalert2.min.css}"/>
    <script th:src="@{/admin/plugins/jquery/jquery.min.js}"></script>
    <script th:src="@{/mall/jquery/jquery-3.7.1.min.js}"></script>
    <script th:src="@{/admin/dist/js/public.js}"></script>
    <script th:src="@{/admin/plugins/sweetalert2/sweetalert2.all.min.js}"></script>
    <script th:src="@{/mall/js/header.js}" type="text/javascript"></script>
    <script th:inline="javascript">
        let ctx = /*[[@{/}]]*/"";
        if (ctx.endsWith("/")) {
            ctx = ctx.substring(0, ctx.length - 1);
        }
    </script>
</head>
<nav id="nav" th:fragment="nav-fragment">
    <div class="banner_x center">
        <a th:href="@{/shopping/index}" class="logo"><h1>买得起商城</h1></a>
<!--        <div class="fr">-->
<!--            <div class="search">-->
<!--                <input class="text" type="text" id="keyword" autocomplete="off">-->
<!--                <div class="search_hot">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="button iconfont icon-search" onclick="search()"></div>-->
<!--        </div>-->
    </div>
</nav>
<header id="header" th:fragment="header-fragment">
    <div class="center">
        <ul class="fl">
            <li><a th:href="@{/shopping/index}">商城首页</a></li>
        </ul>
        <div class="fr">
            <!-- 用户已登录时显示的部分 -->
            <th:block th:if="${session.name != null}">
                <div class="user">
                    <ul class="selector">
                        <li><a th:href="@{/shopping/member/personal}">个人中心</a></li>
                        <li><a th:href="@{/shopping/orders}">我的订单</a></li>
                        <li><a th:href="@{/shopping/member/logout}" id="logout">退出登录</a></li>
                    </ul>
                    <a href="#" class="username">
                        <th:block th:text="${session.name}">用户</th:block>
                        <i class="iconfont icon-down"></i>
                    </a>
                </div>
                <div class="shopcart">
                    <a th:href="@{/shopping/cart}" style="color: white;">
                        <i class="iconfont icon-cart"></i>
                        购物车(<th:block th:text="${session.cartCount ?: 0}">0</th:block>)
                    </a>
                </div>

            </th:block>
            <!-- 用户未登录时显示的部分 -->
            <th:block th:if="${session.name == null}">
                <ul class="login">
                    <li><a th:href="@{/shopping/member/login}">登录</a></li>
                    <li><a th:href="@{/shopping/member/register}">注册</a></li>
                </ul>
                <div class="shopcart">
                    <a th:href="@{/shopping/member/login}" style="color: white;"><i class="iconfont icon-cart"></i>
                        购物车(0)</a>
                </div>
            </th:block>
        </div>
    </div>
</header>
</html>